package com.oceansoft.core.jxkh.service.impl;

import com.hui.platform.system.exception.HuiException;
import com.oceansoft.core.common.util.Pagination;
import com.oceansoft.core.domain.SysDept;
import com.oceansoft.core.domain.SysUser;
import com.oceansoft.core.jxkh.dao.ITaskRelationDao;
import com.oceansoft.core.jxkh.domain.BeChecker;
import com.oceansoft.core.jxkh.domain.Checker;
import com.oceansoft.core.jxkh.service.ITaskRelationService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by begcoffee on 2017/12/11.
 */
@Service
public class TaskRelationServiceImpl implements ITaskRelationService {
    @Resource
    private ITaskRelationDao taskRelationDao;
    @Override
    public List<Checker> querybycondition(HashMap<String, String> map, SysUser user) {
        return taskRelationDao.querybycondition(map,user);
    }

    @Override
    public void deleteCheck(String dbid) throws HuiException {
        //先删除被考核人
        taskRelationDao.deleteAllBeCheck(dbid);

        taskRelationDao.deleteCheck(dbid);
    }

    @Override
    public List<SysUser> checkUserList(HashMap<String, String> paramap, SysUser user) {
        return taskRelationDao.checkUserList(paramap,user);
    }

    @Override
    public void saveChecker(Checker checker) throws HuiException {
        taskRelationDao.saveChecker(checker);
    }

    @Override
    public List<BeChecker> relationList(HashMap<String, String> map, SysUser user) throws HuiException {
        return taskRelationDao.relationList(map,user);
    }

    @Override
    public void deleteBeCheck(String dbid) throws HuiException {
        taskRelationDao.deleteBeCheck(dbid);
    }

    @Override
    public List<SysUser> beCheckerList(HashMap<String, String> map, SysUser user) {
        return taskRelationDao.beCheckerList(map,user);
    }

    @Override
    public void saveBeChecker(BeChecker checker) throws HuiException {
        taskRelationDao.saveBeChecker(checker);
    }

    @Override
    public List<Map<String,Object>> getFirstLevelDept(boolean isadmin,SysUser user) {
        return taskRelationDao.getFirstLevelDept(isadmin,user);
    }

    @Override
    public List<Map<String, Object>> findCheckerByDeptidAndTaskId(Object deptid, String taskId) {
        return taskRelationDao.findCheckerByDeptidAndTaskId(deptid,taskId);
    }

    @Override
    public List<SysUser> findBeCheckerByCheckeridAndTaskId(Object checkerid, String taskId) {
        return taskRelationDao.findBeCheckerByCheckeridAndTaskId(checkerid,taskId);
    }
}
